<?php
header('Content-Type: application/json; charset=utf-8');
require '../source/class/class_core.php';
$discuz = C::app();
$discuz->init();
include_once libfile('function/block');
loadcache('blockclass');
$siteurl = $_SERVER['REQUEST_SCHEME'].'://'.$_SERVER['SERVER_NAME'].(($_SERVER['SERVER_PORT']==80)?'':$_SERVER['SERVER_PORT']).'/';
block_get_batch($_GET['bid']);
$data = block_fetch_content($_GET['bid'], true);

$search = "/(href|src)\=(\"|')(?![fhtps]+\:)(.*?)\\2/i";
$replace = "\\1=\\2$siteurl\\3\\2";
$data = preg_replace($search, $replace, $data);
echo addcslashes($data, "'\\");

?>